package View.MaintainPage.gDelete;


import View.MaintainPage.gMain.Mainweihu;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import sx.dao.GoodsDao;

public class Maindelete extends Application {
	
	  @FXML
	    private Label resultshow1;
	  @FXML
	    private Button deletebutton;
	    @FXML
	    private Button endButton;

	    @FXML
	    private TextField deleteid;

    @FXML
    void Rback3(ActionEvent event) {
    	try {
			 new Mainweihu().start(new Stage());//������Ʒ����
			 
		} catch (Exception e) {
			// TODO: handle exception
		}
    	exitButtonOnMouseClicked(endButton);
    }
    @FXML
    void going(ActionEvent event) {
    	int gid=Integer.parseInt(deleteid.getText());
    	GoodsDao goodsDelete=new GoodsDao();
    	goodsDelete.deleteGoods(gid);
    }
  //���ٵ�ǰ���ڵĴ���
    //exitButton�ǵڶ����ڵ��˳���ť
    public void exitButtonOnMouseClicked(Button exitButton) {
        Stage stage = (Stage)exitButton.getScene().getWindow();
        stage.close();
    }
	@Override
	public void start(Stage primaryStage) {

		try {
			Class clazz = getClass();
			Parent root = FXMLLoader.load(clazz.getResource("Maindelete.fxml"));
			Scene scene = new Scene(root, 600, 600);
			scene.getStylesheets().add(getClass().getResource("/sources/Css/application1.css").toExternalForm());
			primaryStage.setScene(scene);
			primaryStage.show();
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	public static void main(String[] args) {
		launch(args);
	}

}
